package com.javasm.adminapi.module.product.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.javasm.adminapi.module.product.entity.TSpu;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * SPU 商品表(TSpu)表数据库访问层
 *
 * @author makejava
 * @since 2025-10-14 22:29:06
 */
public interface TSpuDao extends BaseMapper<TSpu> {

    @Select("SELECT \n" +
            "        s.*,\n" +
            "        b.brand_name as brandName,\n" +
            "        c.category_name as categoryName\n" +
            "    FROM t_spu s\n" +
            "    LEFT JOIN t_brand b ON s.brand_id = b.id\n" +
            "    LEFT JOIN t_category c ON s.category_id = c.id\n" +
            "    ORDER BY s.id ")
    List<TSpu> selectAll();
}

